package com.baize.baizeapp.test.jetpack

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.baize.baizeapp.R

class TestJetpackActivity : AppCompatActivity() {
    lateinit var viewModel: TestViewModel

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test_jetpack)
        viewModel = ViewModelProvider.NewInstanceFactory().create(TestViewModel::class.java)
        viewModel.userLiveData.observe(this,
            Observer<String> {
                Log.i("yanze", "onCreate: ${it}")
            })
        viewModel.getUserInfo()
    }
}